<template>
	<view>
		<!-- 筛选 -->
		
		<navigator url="/pages/product/productdestail/index" open-type="navigate">
			<!-- <view class="product-box">
				<view>
					<image style="width:100px;height:100px" src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic1.win4000.com%2Fwallpaper%2F8%2F55402f62682e3.jpg&refer=http%3A%2F%2Fpic1.win4000.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670579929&t=b5343554c15bc2640fbbe66d4f136d79" mode=""></image>
				</view>
				<view class="box-right">
					<view class="right-top">
						<view style="font-weight: 600;">干燥机</view>
						<view class="price">865.0台</view>
					</view>
					<view class="desc">
						<view>产品编号：CP20220111110225622</view>
						<view>型号：8种规格</view>
						<view>库存数量：865</view>
					</view>
				</view>
			</view> -->
		</navigator>
		<view v-for="(item) in list" :key="item.id">
			<!-- <navigator :url="'/pages/product/productdestail/index?productNo='+item.productNo" open-type="navigate"> -->
				<view class="product-box"  @click="clickFn(item)">
						<view>
							<image style="width:100px;height:100px" :src="item.image" mode=""></image>
						</view>
						<view class="box-right">
							<view class="right-top">
								<view style="font-weight: 600;">{{item.productName}}</view>
								<view class="price">{{item.sums==null ? 0:item.sums}}台</view>
							</view>
							<view class="desc">
								<view>产品编号：{{item.productNo}}</view>
								<view>型号：{{item.modelCount}}种规格</view>
								<view>库存数量：{{item.sums==null ? 0:item.sums}}</view>
							</view>
						</view>
				</view>
			<!-- </navigator> -->
		</view>
		
	</view>
</template>

<script>
	import {listProduct} from "@/api/product/product.js"
	
	export default {
		data() {
			return {
				formData:{
					pageSize:10,
					pageNum:1,
				},
				list:[],//产品列表
				total:0,//总计
				
				
			};
		},
		onLoad(){
			this.initData()
		},
		methods:{
			// 初始加载
			async initData(){
			const res=await	listProduct(this.formData)
			// console.log(res);
			this.list=res.rows
			this.total=res.total
			},
			clickFn(e){
				// console.log(e);
				uni.navigateTo({
					url:"/pages/product/productdestail/index?item="+encodeURIComponent(JSON.stringify(e))
				})
			}
		}
	}
</script>

<style lang="scss">
	*{
		margin: 0;
		padding: 0;
	}
	.product-box{
		display: flex;
		background-color: #fff;
		padding: 10px ;
		margin-top: 5px;
		.box-right{
			margin-left: 10px;
			flex:1;
			.right-top{
				display: flex;
				justify-content: space-between;
				font-size: 15px;
					
				.price{
					color: #fd9540;
				}
			}
			.desc{
				font-size: 12px;
				color: #9a9a9a;
				view{
					padding-top: 8px;
				}
			}
		}
		
	}

</style>
